#include <iostream>
using namespace std;
// 从str的第0个开始，
int getLongestPalindrome(string A) {
  // write code here
  int res = 0, step;
  for (int i = 0; i < A.size(); i++) {
    int l = i - 1, r = i + 1;
    step = 1;
    while (r < A.size() && A[i] == A[r]) {
      ++r;
    }
    while (l >= 0 && r < A.size() && A[l] == A[r]) {
      ++r;
      --l;
    }
    res = max(res, r - l - 1);
  }
  return res;
};

int main() {
  getLongestPalindrome("aa");
  return 0;
}
